<?php
// 获得所有医生信息
// header("content-type:text/html;charset=UTF-8");
include_once("conn.php");

if (isset($_GET["docid"])) {
    $docid = $_GET["docid"];
    $select = "SELECT * FROM doc_infos WHERE doc_ID = '" . $docid . "'";
} else {
    die("<script>alert('传递参数错误！');history.go(-1);</script>");
}

$result = mysqli_query($connect_DB, $select);
if ($result) {
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_object($result);
        if ($row->doc_ResetKey == "") {
            $tips = "生成密钥";
        } else {
            $tips = "更新密钥";
        }

        if ($row->doc_ResetKey == "") {
            $key = "暂未生成密钥";
        } else {
            $key = $row->doc_ResetKey;
        }
        echo "
        <div class='r-info-div'>
            <h4>查 询 结 果</h4>
            <div class='reset-infos'>
                <p>医生工号：<span id='id_span'>" . $row->doc_ID . "</span></p>
                <p>医生姓名：<span>" . $row->doc_Name . "</span></p>
                <p>重置密钥：<span><b id='resetkey'>" . $key . "</b></span></p>
                <button class='btn btn-outline-success' type='button' onclick='createKey()'>" . $tips . "</button>
            </div>
        </div>";
    } else {
        echo "<div class='r-info-div'><p class='none-info'>未查询到信息</p></div>";
    }
} else {
    echo "<p class='s-info'>查询出错：" . $select . "</p>";
}

$connect_DB->close();
?>